package com.jrh.biz.user.like;

import com.jrh.dal.UserLikeDao;
import com.jrh.dal.user.like.UserLikeAtlasDao;
import com.jrh.dal.user.like.UserLikeBrandDao;
import com.jrh.dal.user.like.UserLikeProductDao;
import com.jrh.dal.user.like.UserLikeShowroomDao;
import com.jrh.domain.common.Page;
import com.jrh.domain.entity.Atlas;
import com.jrh.domain.entity.Brand;
import com.jrh.domain.entity.Product;
import com.jrh.domain.entity.Showroom;

/**
 * 用户喜欢读服务
 * 
 * @author jasen.hsu.cn@gmail.com 2012-8-7 下午7:07:59
 */
public class UserLikeReadServiceImpl implements UserLikeReadService {

    private UserLikeAtlasDao    userLikeAtlasDao;

    private UserLikeProductDao  userLikeProductDao;

    private UserLikeShowroomDao userLikeShowroomDao;

    private UserLikeBrandDao    userLikeBrandDao;

    private UserLikeDao         userLikeDao;

    public Page<Product> listUserLikeProducts(Long userId, Integer pageIndex, Long style, Long category) {
        return userLikeProductDao.listUserLikeItems(userId,
                                                    userLikeProductDao.getStartIndex(pageIndex,
                                                                                     UserLikeReadService.USER_LIKE_PRODUCT_PAGE_SIZE),
                                                    UserLikeReadService.USER_LIKE_PRODUCT_PAGE_SIZE, style, category);
    }

    public Page<Atlas> listUserLikeAtlas(Long userId, Integer pageIndex, Long style, Long category) {
        return userLikeAtlasDao.listUserLikeItems(userId,
                                                  userLikeAtlasDao.getStartIndex(pageIndex,
                                                                                 UserLikeReadService.USER_LIKE_ATLAS_PAGE_SIZE),
                                                  UserLikeReadService.USER_LIKE_ATLAS_PAGE_SIZE, style, category);
    }

    @Override
    public Page<Showroom> listUserLikeShowroom(Long userId, Integer pageIndex, Long style, Long category) {
        return userLikeShowroomDao.listUserLikeItems(userId,
                                                     userLikeShowroomDao.getStartIndex(pageIndex,
                                                                                       UserLikeReadService.USER_LIKE_SHOWROOM_PAGE_SIZE),
                                                     UserLikeReadService.USER_LIKE_SHOWROOM_PAGE_SIZE, style, category);
    }

    @Override
    public Page<Brand> listUserLikeBrand(Long userId, Integer pageIndex, Long style, Long category) {
        return userLikeBrandDao.listUserLikeItems(userId,
                                                  userLikeBrandDao.getStartIndex(pageIndex,
                                                                                 UserLikeReadService.USER_LIKE_BRAND_PAGE_SIZE),
                                                  UserLikeReadService.USER_LIKE_BRAND_PAGE_SIZE, style, category);
    }

    public Integer getUserlikeAllNum(Long userId) {
        return userLikeDao.getUserlikeAllNum(userId);
    }

    public void setUserLikeAtlasDao(UserLikeAtlasDao userLikeAtlasDao) {
        this.userLikeAtlasDao = userLikeAtlasDao;
    }

    public void setUserLikeProductDao(UserLikeProductDao userLikeProductDao) {
        this.userLikeProductDao = userLikeProductDao;
    }

    public void setUserLikeShowroomDao(UserLikeShowroomDao userLikeShowroomDao) {
        this.userLikeShowroomDao = userLikeShowroomDao;
    }

    public void setUserLikeBrandDao(UserLikeBrandDao userLikeBrandDao) {
        this.userLikeBrandDao = userLikeBrandDao;
    }

    public void setUserLikeDao(UserLikeDao userLikeDao) {
        this.userLikeDao = userLikeDao;
    }

}
